dofile ("libProgressBar.lua")

ProgressBar.init (1, SCREEN_DOWN, 5, 5, 150, 25, 50, 1)
ProgressBar.init (2, SCREEN_DOWN, 5, 40, 200, 30, 50, 2)
ProgressBar.init (3, SCREEN_DOWN, 5, 80, 50, 15, 50, 3)
ProgressBar.init (4, SCREEN_DOWN, 5, 105, 250, 35, 50, 4)

while not Keys.newPress.Start do
  
  Controls.read()
  
  val1 = ProgressBar.value (1)
  val2 = ProgressBar.value (2)
  val3 = ProgressBar.value (3)
  val4 = ProgressBar.value (4)
  valMax1 = ProgressBar.valueMax (1)
  valMax2 = ProgressBar.valueMax (2)
  valMax3 = ProgressBar.valueMax (3)
  valMax4 = ProgressBar.valueMax (4)
  
  startDrawing()
    
    ProgressBar.draw (1)
    ProgressBar.draw (2, c_rouge)
    ProgressBar.draw (3, c_bleu)
    ProgressBar.draw (4, c_jaune)
    
    if Keys.held.Right then
      ProgressBar.addValue (1, 1)
      ProgressBar.subValue (2, 1)
    end
    if Keys.held.Left then
      ProgressBar.subValue (1, 1)
      ProgressBar.addValue (2, 1)
    end
    if Keys.held.Down then
      ProgressBar.addValue (3, 1)
      ProgressBar.subValue (4, 1)
    end
    if Keys.held.Up then
      ProgressBar.subValue (3, 1)
      ProgressBar.addValue (4, 1)
    end
    
    screen.print (SCREEN_UP, 5, 5, "Value ProgressBar 1 : "..val1.." / "..valMax1.."")
    screen.print (SCREEN_UP, 5, 25, "Value ProgressBar 2 : "..val2.." / "..valMax2.."")
    screen.print (SCREEN_UP, 5, 45, "Value ProgressBar 3 : "..val3.." / "..valMax3.."")
    screen.print (SCREEN_UP, 5, 65, "Value ProgressBar 4 : "..val4.." / "..valMax4.."")
    screen.print (SCREEN_UP, 5, 85, "Held any directional key to")
    screen.print (SCREEN_UP, 5, 95, "change the values")
    
  stopDrawing()

end

ProgressBar.clear (1)

val1 = nil
val2 = nil
valMax1 = nil
valMax2 = nil

